package cqut.wys.config;

import org.apache.kafka.clients.CommonClientConfigs;
import org.apache.kafka.clients.admin.AdminClient;

import java.util.Properties;

/**
 * --------神兽出没--------/
 *   ┌─┐     ┌─┐
 * ┌─┘─┴─────┘─┴─┐
 * │      ─      │
 * │  ┬─┘   └─┬  │
 * │             │
 * │      ┴      │  Code is far away from bug with the animal protecting
 * └───┐      ┌──┘  神兽保佑,代码无bug
 *     │      │
 *     │      └──────┐
 *     │             ├┐
 *     │             ┌┘
 *     └┐ ┐ ┌───┬─┐ ┌┘
 *      │ ┤ ┤   │ ┤ ┤
 *      └─┴─┘   └─┴─┘
 * --------感觉萌萌哒--------/
 *
 * @author wuyoushan
 * @date 2018/7/1
 */
public class KafkaClientConfig {

    private String brokerUrl;

    public KafkaClientConfig() {

    }

    public KafkaClientConfig(String brokerUrl) {
        this.brokerUrl = brokerUrl;
    }

    public KafkaClientConfig brokerUrl(String brokerUrl) {
        this.brokerUrl = brokerUrl;
        return this;
    }

    public AdminClient build(){
        Properties properties = new Properties();
        properties.put(CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG,brokerUrl);
        return AdminClient.create(properties);
    }

}
